package com.xy.biz.fd.service.impl;

import com.xy.biz.fd.domain.bo.DocumentRubbishBO;
import com.xy.biz.fd.domain.query.DocumentRubbishQuery;
import com.xy.biz.fd.manager.DocumentRubbishManager;
import com.xy.biz.fd.service.DocumentRubbishService;
import com.xy.lang.domain.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * 
 * 
 * @author yzh
 * @date 2021年1月30日
 */
@Service
public class DocumentRubbishServiceImpl implements DocumentRubbishService {

	@Autowired
	private DocumentRubbishManager documentRubbishManager;
	
	@Override
	public Result<?> saveDocumentRubbish(DocumentRubbishBO documentRubbishBO) {
		int affectedRows = documentRubbishManager.saveDocumentRubbish(documentRubbishBO);
		if (affectedRows > 0) {
			return Result.success();
		}
		return Result.ofErrorRowsAffected();
	}
	
	@Override
	public Result<?> saveAllDocumentRubbish(Collection<DocumentRubbishBO> collection) {
		int affectedRows = documentRubbishManager.saveAllDocumentRubbish(collection);
		if (affectedRows > 0) {
			return Result.success();
		}
		return Result.ofErrorRowsAffected();
	}
	
	@Override
	public Result<?> updateDocumentRubbish(DocumentRubbishBO documentRubbishBO) {
		int affectedRows = documentRubbishManager.updateDocumentRubbish(documentRubbishBO);
		if (affectedRows > 0) {
			return Result.success();
		}
		return Result.ofErrorRowsAffected();
	}
	
	@Override
	public Result<?> deleteDocumentRubbish(java.lang.Long documentRubbishId) {
		int affectedRows = documentRubbishManager.deleteDocumentRubbish(documentRubbishId);
		if (affectedRows > 0) {
			return Result.success();
		}
		return Result.ofErrorRowsAffected();
	}
	
	@Override
	public DocumentRubbishBO getDocumentRubbish(java.lang.Long documentRubbishId) {
		return documentRubbishManager.getDocumentRubbish(documentRubbishId);
	}
	
	@Override
	public List<DocumentRubbishBO> listDocumentRubbishById(Collection<java.lang.Long> collection) {
		return documentRubbishManager.listDocumentRubbishById(collection);
	}
	
	@Override
	public List<DocumentRubbishBO> listDocumentRubbish(DocumentRubbishQuery query) {
		return documentRubbishManager.listDocumentRubbish(query);
	}
	
	@Override
	public int countDocumentRubbish(DocumentRubbishQuery query) {
		return documentRubbishManager.countDocumentRubbish(query);
	}
	
}
